<?php
//if (isset($_SESSION['username'])) {
include_once 'header.php';
require_once("../conn.php");
require_once("../change_page.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv= "Content-Type" content= "text/html; charset=utf-8" charset= "utf-8 "/>
        <title>乐知家园</title>
        <script language="javascript">
            function getRealData(){
                location.href = "marketSuggest.php?method=real&menu=suggest";
            }
            function getModifyData(){
                location.href = "marketSuggest.php?method=modify&menu=suggest";
            }
        </script>
        <style type="text/css">
            <!--
            body,td,th {
                font-family: 微软雅黑;
                font-size: 14px;
                color: #000000;
            }

            .STYLE1 {color: #FFFFFF}
            -->
        </style></head>
    <?php
    $sql = "SELECT * FROM t_hibaby_resource_version ORDER BY os";
    $db = new DBC();
    $data = $db->fetchData($sql);
    ?>
    <body>
        <br/>
        <form action="save.action.php?module=resource" method="post">
            <table width="80%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#9999FF">
                <tr align="center">
                    <td align="left">
                        &nbsp;<input type="submit" value="保存" onclick="save()"/></td>
                </tr>
            </table>
            <br/>
            <table width="80%" border="0" align="center" cellpadding="1" cellspacing="1">
                <tr align="center">
                    <td bgcolor="#666666" width="5%"><span class="STYLE1">序号</span></td>
                    <td bgcolor="#666666" width="10%" align="left">&nbsp;&nbsp;<span class="STYLE1">名称</span></td>
                    <td bgcolor="#666666" width="10%" align="left">&nbsp;&nbsp;<span class="STYLE1">题包</span></td>
                    <td bgcolor="#666666" width="5%" align="left">&nbsp;&nbsp;<span class="STYLE1">版本</span></td>
                    <td bgcolor="#666666" width="10%"><span class="STYLE1">操作系统</span></td>
                    <td bgcolor="#666666" width="40%"><span class="STYLE1">URL</span></td>
                </tr>
                <?php
                $num = 0;
                if ($data != false && count($data) > 0) {
                    foreach ($data as $row) {
                        ?>
                        <tr>
                            <td bgcolor="#FFFFFF">&nbsp;<?php echo++$num; ?></td>
                            <td bgcolor="#FFFFFF">&nbsp;
                                <select type="text" name="name[]" >
                                    <option  value=""></option>
                                    <option  value="question" <?php
                if ($row['name'] == "question") {
                    echo "selected";
                }
                        ?> >Question</option>
                                    <option  value="voice" <?php
                                     if ($row['name'] == "voice") {
                                         echo "selected";
                                     }
                        ?>>Voice</option>
                                    <option  value="answer" <?php
                                     if ($row['name'] == "answer") {
                                         echo "selected";
                                     }
                        ?>>Answer</option>
                                    <option  value="icon" <?php
                if ($row['name'] == "icon") {
                    echo "selected";
                }
                        ?> >ICON</option>
                                </select></td>
                            <td bgcolor="#FFFFFF">&nbsp;
                                <select type="text" name="titlePacket[]" >
                                    <option  value=""></option>
                                    <option  value="Panimal" <?php
                                     if ($row['titlePacket'] == "Panimal") {
                                         echo "selected";
                                     }
                        ?> >Panimal</option>
                                    <option  value="Pmusic" <?php
                                     if ($row['titlePacket'] == "Pmusic") {
                                         echo "selected";
                                     }
                        ?>>Pmusic</option>
                                    <option  value="Pnomal" <?php
                                     if ($row['titlePacket'] == "Pnomal") {
                                         echo "selected";
                                     }
                        ?>>Pnomal</option>
                                </select></td>
                            <td bgcolor="#FFFFFF">&nbsp;<input type="text" name="version[]" value="<?php echo $row['version']; ?>" /></td>
                            <td bgcolor="#FFFFFF">&nbsp;<select type="text" name="os[]" >
                                    <option  value=""></option>
                                    <option  value="android" <?php
                                     if ($row['os'] == "android") {
                                         echo "selected";
                                     }
                        ?>>Android</option>
                                    <option  value="ios" <?php
                                     if ($row['os'] == "ios") {
                                         echo "selected";
                                     }
                        ?>>IOS</option>
                                    <option  value="pc" <?php
                                     if ($row['os'] == "pc") {
                                         echo "selected";
                                     }
                        ?>>PC</option>
                                </select></td>
                            <td bgcolor="#FFFFFF" align="center">&nbsp;<input type="text" name="url[]" value="<?php echo $row['url']; ?>" style="width:400px;text-align: left" />&nbsp;</td>
                        </tr>
                        <?php
                    }
                }
                if ($num < 50) {
                    for ($i = $num; $i < 50; $i++) {
                        ?>
                        <tr>
                            <td bgcolor="#FFFFFF">&nbsp;<?php echo++$num; ?></td>
                            <td bgcolor="#FFFFFF">&nbsp;
                                <select type="text" name="name[]" >
                                    <option  value=""></option>
                                    <option  value="question">Question</option>
                                    <option  value="voice">Voice</option>
                                    <option  value="answer">Answer</option>
                                    <option  value="icon">ICON</option>
                                </select></td>
                            <td bgcolor="#FFFFFF">&nbsp;
                                <select type="text" name="titlePacket[]" >
                                    <option  value=""></option>
                                    <option  value="Panimal">Panimal</option>
                                    <option  value="Pmusic" >Pmusic</option>
                                    <option  value="Pnomal">Pnomal</option>
                                </select></td>
                            <td bgcolor="#FFFFFF">&nbsp;<input type="text" name="version[]" value="" /></td>
                            <td bgcolor="#FFFFFF">&nbsp;<select type="text" name="os[]" >
                                    <option  value=""></option>
                                    <option  value="android">Android</option>
                                    <option  value="ios">IOS</option>
                                    <option  value="pc">PC</option>
                                </select></td>
                            <td bgcolor="#FFFFFF" align="center">&nbsp;<input type="text" name="url[]" value="" style="width:400px;text-align: right" />&nbsp;</td>
                        </tr>
                        <?php
                    }
                }
                ?>
            </table>
        </form>
    </body>
</html>
<?php
include_once '../footer.php';
?>